﻿<UserControl x:Class="Southridge.View.MapView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:view="clr-namespace:Southridge.View"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"
    >
    <UserControl.Resources>       
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <!-- MAB CHANGE <ResourceDictionary Source="pack://application:,,,/Resources/DataEntryStyles.xaml" /> 
                <ResourceDictionary Source="pack://application:,,,/Southridge;component/Resources/DataEntryStyles.xaml" />-->
            </ResourceDictionary.MergedDictionaries>
       
             
	
	<LinearGradientBrush x:Key="Brush_RibbonButtonIsMouseOverSmallBackground" StartPoint="0,0" EndPoint="0,1">
        <GradientStop Offset="0" Color="#FFFDEB"/>
        <GradientStop Offset="0.5" Color="#FFECAF"/>
        <GradientStop Offset="0.5" Color="#FFD960"/>
        <GradientStop Offset="1.0" Color="#FFE89A"/>
    </LinearGradientBrush>
	
	<LinearGradientBrush x:Key="DataGridHeaderMouseOverBackgroundBrush" StartPoint="0,0" EndPoint="0,1">
        <GradientStop Color="#90B321" Offset="0" />
        <GradientStop Color="#66A002" Offset="1" />
    </LinearGradientBrush>
	
        <DrawingBrush x:Key="Layer_1" Stretch="Uniform">
            <DrawingBrush.Drawing>
                <DrawingGroup>
                	<GeometryDrawing Geometry="F1 M 26.0117,8.31599L 25.9909,8.27433L 7.62861,8.14935L 7.60777,22.6059L 13.0862,22.6059L 16.8244,26.523L 20.9394,22.6059L 25.9596,22.6059L 26.0117,8.31599 Z ">
                		<GeometryDrawing.Pen>
                			<Pen LineJoin="Round" Brush="#FF000000"/>
                		</GeometryDrawing.Pen>
                		<GeometryDrawing.Brush>
                			<LinearGradientBrush StartPoint="0.935995,0.0385985" EndPoint="0.922413,0.766453">
                				<GradientStop Color="#FFFEAA5A" Offset="0"/>
                				<GradientStop Color="#FFFF7D00" Offset="1"/>
                			</LinearGradientBrush>
                		</GeometryDrawing.Brush>
                	</GeometryDrawing>
                	<GeometryDrawing Brush="#FFFFFFFF" Geometry="M 20.5688,16.368L 20.5156,10.4249L 13.0463,10.4249L 13.0281,16.368L 10.2212,16.4097L 16.9035,22.6799L 23.5945,16.368L 20.5688,16.368 Z ">
                		<GeometryDrawing.Pen>
                			<Pen Thickness="0.499937" LineJoin="Round" Brush="#8048494A"/>
                		</GeometryDrawing.Pen>
                	</GeometryDrawing>
                	<GeometryDrawing Geometry="F1 M 19.069,17.0346L 18.9909,11.5874L 14.4705,11.5874L 14.5121,17.0659L 12.3874,17.045L 16.7984,21.2111L 21.5531,17.0346L 19.069,17.0346 Z ">
                		<GeometryDrawing.Brush>
                			<LinearGradientBrush StartPoint="0.488645,0.957796" EndPoint="1.44334,0.957796">
                				<LinearGradientBrush.RelativeTransform>
                					<TransformGroup>
                						<SkewTransform CenterX="0.488645" CenterY="0.957796" AngleX="-0.0950054" AngleY="0"/>
                						<RotateTransform CenterX="0.488645" CenterY="0.957796" Angle="268.977"/>
                					</TransformGroup>
                				</LinearGradientBrush.RelativeTransform>
                				<GradientStop Color="#FF1C6ADB" Offset="0"/>
                				<GradientStop Color="#FF5E90D9" Offset="0.479452"/>
                				<GradientStop Color="#FFA0B6D7" Offset="1"/>
                			</LinearGradientBrush>
                		</GeometryDrawing.Brush>
                	</GeometryDrawing>
                </DrawingGroup>
            </DrawingBrush.Drawing>
        </DrawingBrush>

        <Style x:Key="MapItemTooltipStyle" TargetType="{x:Type ToolTip}">
            <Setter Property="OverridesDefaultStyle" Value="true"/>
            <Setter Property="VerticalOffset" Value="5" />
            <Setter Property="HorizontalOffset" Value="5" />
            <Setter Property="Placement" Value="Top" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type ToolTip}">
                        <Grid x:Name="Border" Background="Transparent" Width="{TemplateBinding Width}">
                        	<Rectangle VerticalAlignment="Stretch" HorizontalAlignment="Stretch" RadiusX="7.5" RadiusY="7.5" Fill="{DynamicResource DataGridHeaderMouseOverBackgroundBrush}"/>                          
                            <ContentPresenter Margin="10,0,10,0" HorizontalAlignment="Center" VerticalAlignment="Center" 
							TextBlock.Foreground="{DynamicResource FillOverDarkBorderBrush}" TextBlock.FontSize="12" />
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        </ResourceDictionary>
    </UserControl.Resources>
        <Border x:Name="MapPanel" Grid.Row="1" Visibility="Visible">
        	<Grid Background="LightGray">
        		<Button HorizontalAlignment="Right" VerticalAlignment="Top" Content="X" Height="20" Width="20" Command="view:NavigationCommands.Back" Panel.ZIndex="2"/>			            
        		<Viewbox Stretch="UniformToFill">
        			<ListBox x:Name="listBox" ItemsSource="{Binding Path=Results}" Width="945" Height="895" SelectionMode="Multiple" >
        				<ListBox.Background> 
        					<ImageBrush Stretch="UniformToFill"> 
        						<ImageBrush.ImageSource>
        							<BitmapImage UriSource="pack://application:,,,/Images/SeattleCropped.jpg" /> 
        						</ImageBrush.ImageSource>
        					</ImageBrush>                    
        				</ListBox.Background>
        				<ListBox.ItemsPanel> 
        					<ItemsPanelTemplate> 
        						<Canvas VerticalAlignment="Stretch" HorizontalAlignment="Stretch" IsItemsHost="True" /> 
        					</ItemsPanelTemplate>                    
        				</ListBox.ItemsPanel>
        				<ListBox.ItemContainerStyle> 
        					<Style TargetType="{x:Type ListBoxItem}">
        						<Setter Property="Canvas.Left" Value="{Binding Path=Longitude}" />
        						<Setter Property="Canvas.Top" Value="{Binding Path=Latitude}" />                             
        						<Style.Triggers> 
        							<Trigger Property="IsMouseOver" Value="False"> 
        								<Setter Property="Opacity" Value="0.7" />
        							</Trigger>
        							<Trigger Property="IsMouseOver" Value="true">
        								<Setter Property="Opacity" Value="1"  />
        							</Trigger>
        						</Style.Triggers>
        					</Style>                    
        				</ListBox.ItemContainerStyle>
        				<ListBox.ItemTemplate> 
        					<DataTemplate>
        						<Grid>
        							<Rectangle Width="20" Height="20" Fill="{StaticResource Layer_1}" >
        								<Rectangle.ToolTip >
        									<ToolTip Style="{DynamicResource MapItemTooltipStyle}">
        										<ContentControl Content="{Binding}" Background="Transparent">
        											<ContentControl.ContentTemplate>
        												<DataTemplate>
        													<Grid Width="Auto" Height="Auto" VerticalAlignment="Bottom" HorizontalAlignment="Right" Background="Transparent"  >        			 
        			<Grid.RowDefinitions>                         
        				<RowDefinition Height="Auto"/>
        				<RowDefinition Height="Auto"/>
        				<RowDefinition Height="Auto"/>
        			</Grid.RowDefinitions>
        			<Grid.ColumnDefinitions>
        				<ColumnDefinition />
        				<ColumnDefinition />
						<ColumnDefinition />
        			</Grid.ColumnDefinitions>
					<Rectangle Grid.ColumnSpan="3" Grid.RowSpan="3" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" RadiusX="7.5" RadiusY="7.5" Fill="{DynamicResource DataGridHeaderMouseOverBackgroundBrush}"/>                          
					<TextBlock Style="{DynamicResource SimpleLabelBold}" Text="{Binding ., Converter={StaticResource ListingToOneLineAddressConverter}}" Grid.ColumnSpan="3" FontStyle="Italic"  Margin="0,5,0,0"/>
        			<WrapPanel Grid.Row="1" Grid.ColumnSpan="3" > 					
        			<!--MAB CHANGE <TextBlock Style="{StaticResource SimpleLabel}" Text="{Binding Path=Price, StringFormat={}{0:c}}"  />-->
                    <TextBlock Style="{DynamicResource SimpleLabel}" Text="{Binding Path=Price, StringFormat=\{0:c\}}"  />
        			<TextBlock Style="{DynamicResource SimpleLabel}" Text="{Binding Path=BedroomCount, StringFormat=Bed: \{0\}}" />					
        			<TextBlock Style="{DynamicResource SimpleLabel}" Text="{Binding Path=BathroomCount, StringFormat=Bath: \{0\}}" />
					</WrapPanel> 
					<ContentControl Content="{Binding Path=Neighborhood}" ContentTemplate="{StaticResource NeighborhoodVisualDataTemplate}" Grid.Row="2" Grid.ColumnSpan="3" Margin="5,0,0,5"/> 
        		</Grid> 			        	 
        												</DataTemplate>
        											</ContentControl.ContentTemplate>
        										</ContentControl>
        									</ToolTip>
        								</Rectangle.ToolTip>                                        
        							</Rectangle> 
        						</Grid> 
        					</DataTemplate>                    
        				</ListBox.ItemTemplate>                
        			</ListBox>
        		</Viewbox>                                	        					
        	</Grid>
	</Border>
</UserControl>
